//
//  ExpCell.m
//  jiyujiaProgram
//
//  Created by Jame on 15/12/15.
//  Copyright © 2015年 中良 赵. All rights reserved.
//

#import "ExpCell.h"
#import "ExpModel.h"

@implementation ExpCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setCellWithModel:(NSArray *)model WithIndexPath:(NSIndexPath *)index
{
    ExpData *data = model[index.row];
    
    NSString *start = [self stringWithDate:[NSDate dateWithTimeIntervalSince1970:[[data startTime] integerValue]/1000]];
    NSString *end = [self stringWithDate:[NSDate dateWithTimeIntervalSince1970:[[data endTime] integerValue]/1000]];
    self.timeLabel.text = [NSString stringWithFormat:@"%@-%@",start,end];
    self.descLabel.text = data.descr;
}


- (NSString *)stringWithDate:(NSDate *)date
{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy/MM/dd"];
    NSString *dateString = [dateFormatter stringFromDate:date];
    return dateString;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
